package com.qiall.boot.userservice.data.enums;

import com.qiall.common.service.BaseEnumsService;

/**
 * @author 吴金辉
 */

public enum SexEnum implements BaseEnumsService {

    /**
     * 男
     */
    男((byte) 1,"男"),
    /**
     * 女
     */
    女((byte) 2,"女");


    byte code;
    String desc;
    SexEnum(byte code,String desc){
        this.code=code;
        this.desc=desc;
    }
    @Override
    public String getDesc() {
        return desc;
    }

    @Override
    public byte getCode() {
        return code;
    }
    public static SexEnum ofCode(byte code){
        for (SexEnum sexEnum:SexEnum.values()){
            if(sexEnum.code==code){
                return sexEnum;
            }
        }
        return null;
    }


    public static SexEnum ofDesc(String  desc){
        for (SexEnum sexEnum:SexEnum.values()){
            if(sexEnum.desc.equals(desc)){
                return sexEnum;
            }
        }
        return null;
    }
}
